/* Copyright (c) 2013, Shawn McGregor and Steve Mitchell All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. AT30TS75x.h Notes: Atmel Device requires single 2.7v to 5.5v supply Measures temperature range from -55c to +125c I2C interface with max clock frequency of 3.4Mhz 1ľA current when shutdown mode enabled */ #include #include #ifndef AT30TS75x_H #define AT30TS75x_H // Chipset Address R/W Settings #define AT30TS75x_Read 0b10010001 // 8-bit Default base address location mode for read #define AT30TS75x_Write 0b10010000 // 8-bit Default base address location mode for write // Chipset Registers Index #define AT30TS75xTemperature 0b0000000000000000 // 16-bit Temperature register (default 0x0000) #define AT30TS75xConfig 0b0000000000000001 // 16-bit Configuration register (default 0x0000) #define AT30TS75xTLimitLo 0b0000000000000011 // 16-bit Temperature lower limit register (default 0x4B00) 75c #define AT30TS75xTLimitHi 0b0000000000000010 // 16-bit Temperature high limit register (default 0x5000) 80c // Chipset Configuration Settings #define AT30TS75xOneShotOFF 0b0000000000000000 // Bit-15 R/W One Shot 0: Normal operation (default) #define AT30TS75xOneShotON 0b1000000000000000 // 1: Do single shot #define AT30TS75xResolution9 0b0000000000000000 // Bit-14 R/W Resolution 00: 9-bit calculate: result >> 7 * 0.5 (default) #define AT30TS75xResolution10 0b0010000000000000 // 01: 10-bit calculate: result >> 6 * 0.25 #define AT30TS75xResolution11 0b0100000000000000 // 10: 11-bit calculate: result >> 5 * 0.125 #define AT30TS75xResolution12 0b0110000000000000 // 11: 12-bit calculate: result >> 4 * 0.0625 #define AT30TS75xAlarmFault1 0b0000000000000000 // Bit-12 R/W Fault Queue 00: Alarm after 1 Fault (default) #define AT30TS75xAlarmFault2 0b0000100000000000 // 01: Alarm after 2 Consecutive Faults #define AT30TS75xAlarmFault4 0b0001000000000000 // 10: Alarm after 4 Consecutive Faults #define AT30TS75xAlarmFault6 0b0001100000000000 // 11: Alarm after 6 Consecutive Faults #define AT30TS75xAlarmActiveLo 0b0000000000000000 // Bit-10 R/W Alert polarity 0: Active Lo (default) #define AT30TS75xAlarmActiveHi 0b0000010000000000 // 1: Active Hi #define AT30TS75xCompareOn 0b0000000000000000 // Bit-09 R/W CMP/INT Mode 0: Comparator (default) #define AT30TS75xInterruptOn 0b0000001000000000 // 1: Interrupt #define AT30TS75xShutDownEnabled 0b0000000000000000 // Bit-08 R/W Shutdown Mode 0: Disabled (default) #define AT30TS75xShutDownDisabled 0b0000000100000000 // 1: Enabled // Code Interface int AT30TS75xRead (unsigned int w_register); int AT30TS75xWrite (unsigned int w_register, unsigned int w_value); #endif